<?php include('../resources/views/header.blade.php'); ?>

<section style="margin-bottom:40px;">
    <div style="width:100%;">
        <div class="item" style="width:96%;margin:0 auto;background-color:#58bdfd;padding:2px 4px;border-radius:1px;margin-top:12px;">
            <div style="height:42px;background-color:#fff;border-radius:1px;overflow:hidden;">
                <img src="images/search_icon.png" style="width:30px;height:30px;float:right;margin-top:4px;" id="search_btn" />
                <input style="padding:0;height:100%;border-style:none;margin-left:4px;margin-right:30px;border-radius:0px;outline:none;font-size:18px;" id="search_input" placeholder="搜索问题" />
            </div>
        </div>
        <div style="float:right;margin-top:12px;margin-right:12px;display:block;">
            <a href="/new_questions"><span style="height:30px;padding-top:0px;display:block;color:#58bdfd;">最新问题 >></span></a>
            <a href="/attention"><span style="height:30px;padding-top:0px;display:block;color:#58bdfd;">我的关注 >></span></a>
        </div>
        <div style="display:block;padding-left:12px;margin-top:48px;">
            <span>所有话题</span>
        </div>
        <ul style="clear:both;display:block;list-style-type:none;overflow:hidden;">
            <?php
            if( isset($topic_results) ){
                foreach( $topic_results as $key => $val ){
                    echo '<li>';
                    echo '    <a href="/topic/'.$val['id'].'">';
                    echo '        <div style="position:relative;border-radius:2px;width:92%;height:100px;float:left;margin-left:4%;margin-top:12px;background:url('.$val['cover'].') no-repeat center;background-size:cover;">';
                    echo '            <div style="position:absolute;border-radius:3px;width:100%;height:100%;background:rgba(0,0,0,0.3)">';
                    echo '                <p style="color:#fff;padding-left:12px;position:relative;padding-top:24px;">'.$val['name'].'</p>';
                    echo '                <p style="color:#fff;padding-left:12px;position:relative;">'.$val['count'].' 个相关问题</p>';
                    echo '            </div>';
                    echo '        </div>';
                    echo '    </a>';
                    echo '</li>';
                }
            }
            ?>
        </ul>
    </div>
</section>

<!--导航-->
<nav class="clearfix fixed bottom">
    <ul style="width:100%;">
        <li style="width:50%;text-align:center;"><a href="/">热门</a></li>
        <li style="width:50%;text-align:center;"><a href="#" class="current" >所有</a></li>
    </ul>
</nav>

<?php include('../resources/views/footer.blade.php'); ?>

<script type="text/javascript">
    $("#search_btn").on('click',function(){
        var content       = $("#search_input").val();
        if( content == '' ){
            toast('搜索内容不能为空');
        }else{
            window.location.href = "/search?content="+content;
        }
    });

    function isRootPage(){
        return true;
    }
</script>
